# Python3_DataSimFunc.py
# Create By GF 2023-11-13 10:08

# ----------------------------------------------------------------------------------------------------

# 数据模拟函数(Data Simulation Functions).

# ----------------------------------------------------------------------------------------------------

import random
import pandas

# random.random() # 通过使用 random 模块的 random 函数生成一个 0 到 1 之间的随机小数.
# random.randint(1, 100) # 通过使用 random 模块的 randint 函数生成一个介于 1 到 100 之间的随机整数.
# random.uniform(1, 10) # 通过使用 random 模块的 uniform 函数生成一个介于 1 到 10 之间的随机小数.
# random.sample([1, 2, 3, 4, 5], 3) # 通过使用 random 模块的 sample 函数从序列 [1, 2, 3, 4, 5] 中随机选择 3 个元素.
# round(random.uniform(1, 10), 2) # 使用 random 模块的 uniform 生成一个 1 到 10 之间的随机小数并使用 round 函数保留两位小数.
# [random.uniform(1, 10) for i in range(5)] # 使用列表推导式生成 5 个 1 到 10 之间的随机小数.

#def DataSimFunc_Data_Min_Fall

#def DataSimFunc_Data_Max_Fall

#def DataSimFunc_Data_Min_Rise

#def DataSimFunc_Data_Max_Rise

# 随机优惠额度.
def DataSimFunc_Random_Discount_Amt(DisountList:list) -> float:
    # 在 Python 3.8.0 中 random.sample 的返回值为 List.
    Value = random.sample(DisountList, 1)
    return Value[0]

# 随机降价.
def DataSimFunc_Random_Reduction(Df:pandas.core.frame.DataFrame):
    
    Discount2209 = [0]
    Discount2210 = [0, 400]
    Discount2211 = [300, 300, 300, 400, 400, 800]
    Discount2212 = [400, 600]
    Discount2301 = [200, 200, 600]
    Discount2302 = [0, 100]
    Discount2303 = [0, 150]
    Discount2304 = [50, 200]
    Discount2305 = [100, 200]
    Discount2306 = [100, 300]
    Discount2307 = [0, 100]
    Discount2308 = [100, 200]
    Discount2309 = [200, 300, 400]

    for i in range(0, len(Df["年月Str"])):
        if Df.loc[i, "年月Str"] == "2022-09":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2209))
        elif Df.loc[i, "年月Str"] == "2022-10":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2210))
        elif Df.loc[i, "年月Str"] == "2022-11":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2211))
        elif Df.loc[i, "年月Str"] == "2022-12":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2212))
        elif Df.loc[i, "年月Str"] == "2023-01":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2301))
        elif Df.loc[i, "年月Str"] == "2023-02":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2302))
        elif Df.loc[i, "年月Str"] == "2023-03":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2303))
        elif Df.loc[i, "年月Str"] == "2023-04":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2304))
        elif Df.loc[i, "年月Str"] == "2023-05":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2305))
        elif Df.loc[i, "年月Str"] == "2023-06":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2306))
        elif Df.loc[i, "年月Str"] == "2023-07":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2307))
        elif Df.loc[i, "年月Str"] == "2023-08":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2308))
        elif Df.loc[i, "年月Str"] == "2023-09":
            Df.loc[i, "Low"] = (Df.loc[i, "Official"] - DataSimFunc_Random_Discount_Amt(Discount2309))
